<?php
require_once WEB_ROOT. '/application/library/Bus.php';

class Bus_Privilege extends Bus {
    
    protected $_name = "privileges";
    
    protected function _init() {
        
    }
    
    public function checkPermission(Dto $user, Dto $page) {
        $temps = $this->select(array(
            'fields'   => array(),
            'where'    => "groups_id='{$user->groups_id}' AND pages_id='{$page->id}'",
        ));
        if(count($temps) > 0){
            $temps = $temps[0];
            return $temps->allow;
        }
        return true;
    }
    
}
?>